import Home from '../../../views/Personal/Home/Home.vue'
import Page1 from '../../../views/Personal/Home/pages/1.vue'
import RegisterHome from '../Register/RegisterHome'
import ForgetPasswordHome from '../ForgetPassword/ForgetPassword'
import CompanyPassword from '../ForgetPassword/CompanyPassword'
import PersonalPassword from '../ForgetPassword/PersonalPassword'
import NewPersonal from '../ForgetPassword/NewPersonal'
import NewCompany from '../ForgetPassword/NewCompany'

let PersonalHome={
    path: '/home',
    name: 'Home',
    component: Home,
    children:[
        {
            path:'',
            name:'page1',
            component: Page1
        },
        {
            path:'page2',
            name:'page2',
            component: () => import('../../../views/Personal/Home/pages/2.vue'),
            beforeEnter: (to, from, next) => {
                for(let i=1;i<=8;i++){
                    if(from.name==('page'+i)){
                        next()
                    }else if(from.name=='RegisterHome'){
                        next()
                    }else if(from.name=='ForgetPassword'){
                        next()
                    }else if(from.name=='CompanyPassword'){
                        next()
                    }else if(from.name=='PersonalPassword'){
                        next()
                    }else if(sessionStorage.getItem('fName') && sessionStorage.getItem('fName')=='page2'){
                        next()
                    }
                }
              }
        },
        {
            path:'page3',
            name:'page3',
            component: () => import('../../../views/Personal/Home/pages/3.vue'),
            beforeEnter: (to, from, next) => {
                for(let i=1;i<=8;i++){
                    if(from.name==('page'+i)){
                        next()
                    }else if(from.name=='RegisterHome'){
                        next()
                    }else if(from.name=='ForgetPassword'){
                        next()
                    }else if(from.name=='CompanyPassword'){
                        next()
                    }else if(from.name=='PersonalPassword'){
                        next()
                    }else if(sessionStorage.getItem('fName') && sessionStorage.getItem('fName')=='page3'){
                        next()
                    }
                }
              }
        },
        {
            path:'page4',
            name:'page4',
            component: () => import('../../../views/Personal/Home/pages/4.vue'),
            beforeEnter: (to, from, next) => {
                for(let i=1;i<=8;i++){
                    if(from.name==('page'+i)){
                        next()
                    }else if(from.name=='RegisterHome'){
                        next()
                    }else if(from.name=='ForgetPassword'){
                        next()
                    }else if(from.name=='CompanyPassword'){
                        next()
                    }else if(from.name=='PersonalPassword'){
                        next()
                    }else if(sessionStorage.getItem('fName') && sessionStorage.getItem('fName')=='page4'){
                        next()
                    }
                }
              }
        },
        {
            path:'page5',
            name:'page5',
            component: () => import('../../../views/Personal/Home/pages/5.vue'),
            beforeEnter: (to, from, next) => {
                for(let i=1;i<=8;i++){
                    if(from.name==('page'+i)){
                        next()
                    }else if(from.name=='RegisterHome'){
                        next()
                    }else if(from.name=='ForgetPassword'){
                        next()
                    }else if(from.name=='CompanyPassword'){
                        next()
                    }else if(from.name=='PersonalPassword'){
                        next()
                    }else if(sessionStorage.getItem('fName') && sessionStorage.getItem('fName')=='page5'){
                        next()
                    }
                }
              }
        },
        {
            path:'page6',
            name:'page6',
            component: () => import('../../../views/Personal/Home/pages/6.vue'),
            beforeEnter: (to, from, next) => {
                for(let i=1;i<=8;i++){
                    if(from.name==('page'+i)){
                        next()
                    }else if(from.name=='RegisterHome'){
                        next()
                    }else if(from.name=='ForgetPassword'){
                        next()
                    }else if(from.name=='CompanyPassword'){
                        next()
                    }else if(from.name=='PersonalPassword'){
                        next()
                    }else if(sessionStorage.getItem('fName') && sessionStorage.getItem('fName')=='page6'){
                        next()
                    }
                }
              }
        },
        {
            path:'page7',
            name:'page7',
            component: () => import('../../../views/Personal/Home/pages/7.vue'),
            beforeEnter: (to, from, next) => {
                for(let i=1;i<=8;i++){
                    if(from.name==('page'+i)){
                        next()
                    }else if(from.name=='RegisterHome'){
                        next()
                    }else if(from.name=='ForgetPassword'){
                        next()
                    }else if(from.name=='CompanyPassword'){
                        next()
                    }else if(from.name=='PersonalPassword'){
                        next()
                    }else if(sessionStorage.getItem('fName') && sessionStorage.getItem('fName')=='page7'){
                        next()
                    }
                }
              }
        },
        {
            path:'page8',
            name:'page8',
            component: () => import('../../../views/Personal/Home/pages/8.vue'),
            beforeEnter: (to, from, next) => {
                for(let i=1;i<=8;i++){
                    if(from.name==('page'+i)){
                        next()
                    }else if(from.name=='RegisterHome'){
                        next()
                    }else if(from.name=='ForgetPassword'){
                        next()
                    }else if(from.name=='CompanyPassword'){
                        next()
                    }else if(from.name=='PersonalPassword'){
                        next()
                    }else if(sessionStorage.getItem('fName') && sessionStorage.getItem('fName')=='page8'){
                        next()
                    }
                }
              }
        },
        RegisterHome,
        ForgetPasswordHome,
        CompanyPassword,
        PersonalPassword,
        NewPersonal,
        NewCompany
    ]
}
export default PersonalHome